package com.zcup.designer.behavior.observer;

public class Client {
    public static void main(String[] args) {
        Subject subject = new ConcreteSubject(1);
        Observer observer1 = new ConcreteObserver("1", (ConcreteSubject) subject);
        Observer observer2 = new ConcreteObserver("2", (ConcreteSubject) subject);

        subject.attach(observer1);
        subject.attach(observer2);
        subject.notifyObserver();

        ((ConcreteSubject) subject).subjectState = 2;
        subject.notifyObserver();
    }
}
